<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiImageImageTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_image_image';

    /**
     * Run the migrations.
     * @table qii_image_image
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'MyISAM';
            $table->increments('image_id')->comment('图片ID');
            $table->string('image_name', 120)->comment('图片名称');
            $table->unsignedInteger('width')->default('0')->comment('图片宽度');
            $table->unsignedInteger('height')->default('0')->comment('图片高度');
            $table->string('ext', 10)->default('')->comment('扩展名');
            $table->string('size', 20)->comment('图片大小');
            $table->string('mime', 10)->default('')->comment('mime类型');
            $table->string('ident', 32)->default('')->comment('标识');
            $table->string('url', 200)->default('')->comment('网址');
            $table->string('l_ident', 32)->default('')->comment('缩略图标识');
            $table->string('l_url', 200)->default('')->comment('缩略图网址');
            $table->tinyInteger('watermark')->default('0')->comment('是否有水印');
            $table->unsignedInteger('last_modified')->default('0')->comment('更新时间');
            $table->unsignedInteger('storages_id')->default('0')->comment('文件存储ID');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
